<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<PSAdmin.Core.PagedList<PSAdmin.Core.Domain.PSScript>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Scripts
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="span-12">
        <h2>Scripts</h2>
    </div>
    <div class="span-12 right last">
        <%if (User.IsInRole("Administrators")) { %>
            <%=Html.ActionLink("Create new script", "Create") %>
        <%} %>
    </div>
    <div class="clear"></div>
    <div class="scriptlist">
        <ul>
        <%foreach(var script in Model) { %>
            <li>
                <h3><%=Html.ActionLink(Html.Encode(script.Name), "Details", new { id = script.Id })%></h3>
                <%=Html.Encode(script.Description) %>
                <% if(User.IsInRole("Administrators")) { %>
                        <br /><%=Html.ActionLink("Edit", "Edit", new { id = script.Id })%>
                <%} %>
            </li>           
        <%} %>
        </ul>
    </div>
    <div class="pager">
        <p>
            Page: <%= Html.PageLinks(Model.PageIndex, Model.PageCount, 
                      x => Url.Action("List", new { page = x })) %>
        </p>
    </div>
</asp:Content>
